
#ifndef _SRECPARSER_H
#define _SRECPARSER_H

/******************************************************************************
                   Define(s) section
******************************************************************************/
#define S_SYMBOL                  0x53
#define HANDSHAKE_REQ             0x4b65a5b2
#define HANDSHAKE_CONF            0x26d2d369
#define ACK                       0xb49a5a4d
#define NACK                      0xb25a592d
#define CHECKSUM_AREA_SIZE        1
#define SRECORD_SIZE              128							// The conventional data field length in S-Record

#define EEPROM_START_ADDRESS      0x810000						// Start address of EEPROM area
#define FLASH_START_ADDRESS       0x000000						// Start address of FLASH area
#define EEPROM_END_ADDRESS		  0x810FFF						// End address of EEPROM area
//#define BOOT_AREA_SIZE			  0x800						// 2kbytes boot area size
#define BOOT_AREA_SIZE			  0x1000						// 4kbytes boot area size
#define FLASH_END_ADDRESS		  (0x01FFFF - BOOT_AREA_SIZE)	// End address of FLASH area
#define EEPROM_SIZE				  4096

/******************************************************************************
                   Types section
******************************************************************************/
// Type of record (S0, S1, S2, S3, S5, S7, S8, or S9).
typedef enum
{
  S0 = 0x5330,
  S1 = 0x5331,
  S2 = 0x5332,
  S3 = 0x5333,
  S5 = 0x5335,
  S7 = 0x5337,
  S8 = 0x5338,
  S9 = 0x5339
} SrecordType_t;


/******************************************************************************
                   Prototypes section
******************************************************************************/

/**************************************************************************//**
\brief Handshake procedure.
******************************************************************************/
void srecHandshake(uint8_t infinite);


/**************************************************************************//**
\brief Communication support between host and mcu
******************************************************************************/
void srecProtocol(void);


#endif // _SRECPARSER_H
